<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>

<sql:query var="rs" dataSource="jdbc/j2db">
	select * 
	from leavedata, shift, leaves
	where leavedata.shift_number = shift.shift_number
	and leaves.leave_number = leavedata.leave_number
	and approved = '0'
	order by leaved_date asc
</sql:query>

<sql:query var="rs2" dataSource="jdbc/j2db">
	SELECT *
	FROM shift s, overtimedata od, users us, overtimes ot
	WHERE s.user_id = us.user_id
	AND s.shift_number = od.shift_number
	AND od.ot_number = ot.ot_number
	and approved = '0'
	order by otd_date asc
</sql:query>

<h1>最新消息</h1>
<br>
<br>
<br><br>

<h3>員工編號：${member.user_id}</h3><br>
申請請假未核准項目：<br>
<c:choose>
<c:when test="${rs.rows != null }">
<table border=1 align="center">
<tr>
<th>員工編號</th>
<th>請假日期</th>
<th>請假別</th>
<th>是否核准</th>
<th>核准主管</th>
<th>申請時間</th>
<th>核准動作</th>
</tr>
<c:forEach var="r" items="${rs.rows }">
<tr>
<td><c:out value="${r.user_id }" /></td>
<td><c:out value="${r.leaved_date }" /></td>
<td><c:out value="${r.leave_name }" /></td>
<td><c:out value="${r.approved }" /></td>
<td><c:out value="${r.checker_id }" /></td>
<td><c:out value="${r.leaved_time }" /></td>
<td>
<a href="leavecheck.jsp?id=${r.leaved_number }"><c:out value="核准" /></a>
<a href="leavecheck_no.jsp?id=${r.leaved_number }"><c:out value="不准" /></a>
<a href="leave_edit.jsp?id=${r.leaved_number }"><c:out value="修改" /></a>
</td>
</tr>
</c:forEach>
</table>
</c:when>
<c:otherwise>

</c:otherwise>
</c:choose>

<br><br>
申請加班未核准項目：
<table border=1 align="center">
<tr>
<th>員工編號</th>
<th>加班日期</th>
<th>加班別</th>
<th>是否核准</th>
<th>核准主管</th>
<th>申請時間</th>
<th>核准動作</th>
</tr>
<c:forEach var="r2" items="${rs2.rows}">
<tr>
<td>${r2.user_id }</td>
<td>${r2.otd_date }</td>
<td>${r2.ot_name }</td>
<td>${r2.approved }</td>
<td>${r2.checker_id }</td>
<td>${r2.otd_time }</td>
<td>
<a href="overtimecheck.jsp?id=${r2.otd_number }"><c:out value="核准" /></a>
<a href="overtime_check_no.jsp?id=${r2.otd_number }"><c:out value="不准" /></a>
<a href="overtime_edit.jsp?id=${r2.otd_number }"><c:out value="修改" /></a>
</td>
</tr>
</c:forEach>
</table>